package com.demo.hjh.thread.volatiles;

import com.demo.hjh.thread.atom.Count;

public class Test {
	static volatile   int i = 0, j = 0;

	static void  one() {
		//i++;
		i++;
		j++;
		System.out.println("inner i=" + ++i + " j=" + ++j);
	}

	static synchronized   void two() {
		System.out.println("i=" + i + " j=" + j);
	}

	public static void main(String[] args) {
		
		Runnable runnable = new Runnable() {

			public void run() {
				one();
				try {
					Thread.sleep(1000);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				two();
			}
		};
		for (int i = 0; i < 15; i++) {
			new Thread(runnable).start();
		}
	}
}